<template>
	<view class="home">
		<view class="">
			<view class="flex flex-direction">
				<view class="flex">
					<view class="text-32 text-bold position-relative">
						请输入预约号
						<image src="/static/board/xing.png" mode="" class="xingimg"></image>
					</view>
				</view>
				<image src="/static/board/line.png" mode="" class="lineimg"></image>
			</view>
		</view>
		<view class="bg-ff padding-tb-20 padding-lr-30 radius-50 bg-shadow flex align-center margin-top-30">
			<input type="number" class="flex-one margin-right-30" placeholder="请输入" v-model="phonenumber" />
			<view class="searchbtn" @click="getDetail">查询</view>
		</view>
		<view class="text-32 text-bold margin-top-50">查询预约</view>
		<view class="margin-top-50 flex align-center flex-direction" v-if="detail==''">
			<image src="/static/board/nodata.png" mode="" class="nodata"></image>
			<view class="text-32 text-bold text-center margin-top-15">无预约信息</view>
		</view>
		<view class="margin-top-30 bg-ff bg-shadow padding-30 radius-40" v-else>
			<view class="flex align-center">
				<view class="text-28 text-66">门店名</view>
				<view class="text-28 flex-one margin-left-20 text-cut-one text-right">{{detail.shop_name}}</view>
			</view>
			<view class="flex align-center margin-top-30">
				<view class="text-28 text-66">包间/大厅</view>
				<view class="text-28 flex-one margin-left-20 text-cut-one text-right">{{detail.room_name}}</view>
			</view>
			<view class="flex align-center margin-top-30">
				<view class="text-28 text-66">预约时间</view>
				<view class="text-28 flex-one margin-left-20 text-cut-one text-right">{{detail.date}}</view>
			</view>
			<view class="flex align-center margin-top-30">
				<view class="text-28 text-66">桌游主题</view>
				<view class="text-28 flex-one margin-left-20 text-cut-one text-right">{{detail.theme}}</view>
			</view>
			<view class="flex align-center margin-top-30">
				<view class="text-28 text-66">号码编号</view>
				<view class="text-28 flex-one margin-left-20 text-cut-one text-right">{{detail.code}}</view>
			</view>
			<view class="flex align-center margin-top-30">
				<view class="text-28 text-66">开始时间</view>
				<view class="text-28 flex-one margin-left-20 text-cut-one text-right">{{detail.start_time}}</view>
			</view>
			<view class="flex align-center margin-top-30">
				<view class="text-28 text-66">结束时间</view>
				<view class="text-28 flex-one margin-left-20 text-cut-one text-right">{{detail.end_time}}</view>
			</view>
		</view>
		<view class="wjbg position-relative" v-if="detail!=''">
			<image src="/static/board/wjbg.png" mode="" class="wjimg position-absolute"></image>
			<view class="position-relative wjcont">
				<view class="text-28 text-bold" @click="getJt">加入并开始倒计时</view>
			</view>
			<view class="player1" v-if="detail.occupants_info[0]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[0].status=='正在使用'">
					<image :src="detail.occupants_info[0].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[0].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[0].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[0].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[0].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player2" v-if="detail.occupants_info[1]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[1].status=='正在使用'">
					<image :src="detail.occupants_info[1].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[1].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[1].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[1].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[1].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player3" v-if="detail.occupants_info[2]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[2].status=='正在使用'">
					<image :src="detail.occupants_info[2].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[2].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[2].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[2].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[2].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>

			<view class="player4" v-if="detail.occupants_info[3]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[3].status=='正在使用'">
					<image :src="detail.occupants_info[3].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[3].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[3].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[3].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[3].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player5" v-if="detail.occupants_info[4]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[4].status=='正在使用'">
					<image :src="detail.occupants_info[4].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[4].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[4].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[4].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[4].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player6" v-if="detail.occupants_info[5]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[5].status=='正在使用'">
					<image :src="detail.occupants_info[5].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[5].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[5].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[5].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[5].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player7" v-if="detail.occupants_info[6]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[6].status=='正在使用'">
					<image :src="detail.occupants_info[6].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[6].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[6].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[6].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[6].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player8" v-if="detail.occupants_info[7]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[7].status=='正在使用'">
					<image :src="detail.occupants_info[7].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[7].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[7].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[7].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[7].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player9" v-if="detail.occupants_info[8]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[8].status=='正在使用'">
					<image :src="detail.occupants_info[8].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[8].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[8].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[8].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[8].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player10" v-if="detail.occupants_info[9]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[9].status=='正在使用'">
					<image :src="detail.occupants_info[9].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[9].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[9].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[9].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[9].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player11" v-if="detail.occupants_info[10]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[10].status=='正在使用'">
					<image :src="detail.occupants_info[10].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[10].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[10].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[10].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[10].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player12" v-if="detail.occupants_info[11]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[11].status=='正在使用'">
					<image :src="detail.occupants_info[11].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[11].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[11].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[11].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[11].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail: "",
				phonenumber: ""
			}
		},
		methods: {
			getDetail() {
				if (this.phonenumber == '') {
					this.cn.alert('请输入联系电话')
					return false
				}
				this.rq.getData('Reservations/find_reser', {
					lights_id: uni.getStorageSync('lampid'),
					phone: this.phonenumber
				}).then(res => {
					if (res.code == 1) {
						this.detail = res.data
					}
				})
			},
			getJt() {
				var that = this
				if (that.detail.shared_table > 0) {
					uni.showModal({
						content: '是否确认开始计时?',
						cancelText: '取消',
						cancelColor: "#727272",
						confirmText: "开始计时",
						confirmColor: '#111111',
						success: function(res) {
							if (res.confirm) {
								that.rq.getData('order/join_room', {
									reservations_id: that.detail.id,
									lights_id: uni.getStorageSync('lampid'),
								}).then(res => {
									if (res.code == 1) {
										uni.navigateTo({
											url: '/pages/board/orderdetail?id=' + res.data.id+'&type=2'
										})
									}
								})
							} else if (res.cancel) {

							}
						}
					})
				} else {
					uni.showModal({
						content: '该包间不可接受拼桌 是否确认开始计时?',
						cancelText: '取消',
						cancelColor: "#727272",
						confirmText: "开始计时",
						confirmColor: '#111111',
						success: function(res) {
							if (res.confirm) {
								that.rq.getData('order/join_room', {
									reservations_id: that.detail.id,
									lights_id: uni.getStorageSync('lampid'),
								}).then(res => {
									if (res.code == 1) {
										uni.navigateTo({
											url: '/pages/board/orderdetail?id=' + res.data.id+'&type=2'
										})
									}
								})
							} else if (res.cancel) {

							}
						}
					})
				}
			}
		}
	}
</script>

<style>
	.home {
		width: 100%;
		min-height: 100vh;
		background: #fff;
		padding: 20rpx 30rpx;
	}

	.xingimg {
		width: 20rpx;
		height: 20rpx;
		position: absolute;
		top: -5rpx;
		right: -25rpx;
	}

	.lineimg {
		width: 76rpx;
		height: 10rpx;
	}

	.searchbtn {
		width: 174rpx;
		height: 60rpx;
		background: #101010;
		border-radius: 200rpx 200rpx 200rpx 200rpx;
		font-size: 28rpx;
		color: #FFFFFF;
		line-height: 60rpx;
		text-align: center;
	}

	.nodata {
		width: 552rpx;
		height: 424rpx;
	}

	.wjbg {
		width: 494rpx;
		height: 494rpx;
		margin: 94rpx auto;
		position: relative;
	}

	.wjcont {
		width: 494rpx;
		height: 494rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
	}

	.wjimg {
		width: 604rpx !important;
		height: 604rpx !important;
		position: absolute;
		top: -55rpx;
		left: -55rpx;
	}

	.player1 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: -36rpx;
		left: 204rpx;
	}

	.player2 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: -4rpx;
		left: 74rpx;
	}

	.player3 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: 88rpx;
		left: -26rpx;
	}

	.player4 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: 206rpx;
		left: -40rpx;
	}

	.player5 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: 324rpx;
		left: -26rpx;
	}

	.player6 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		bottom: -18rpx;
		left: 74rpx;
	}

	.player7 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		bottom: -42rpx;
		left: 204rpx;
	}

	.player8 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		bottom: -18rpx;
		right: 62rpx;
	}

	.player9 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		bottom: 70rpx;
		right: -16rpx;
	}

	.player10 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: 206rpx;
		right: -44rpx;
	}

	.player11 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: 88rpx;
		right: -16rpx;
	}

	.player12 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: -4rpx;
		right: 62rpx;
	}

	.playerg {
		width: 21.88rpx;
		height: 21.88rpx;
		position: absolute;
		right: 4rpx;
		bottom: 8rpx;
	}

	.timeimg {
		width: 40rpx;
		height: 40rpx;
	}

	.headimg {
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
	}
</style>